<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// To test manually, drag from the middle of the editable div to the
// right, into the non-floated text. The selection should go to the end
// of the editable element and not jump to the beginning.
selection_test(
    [
        'abc',
        '<div contenteditable id="target" style="float: left;">XYZ</div>',
        '<div style="float: left; width: 100%;">def</div>',
        'ghi',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';
        const target = selection.document.getElementById('target');
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + target.offsetWidth / 2,
            selection.computeTop(target) + target.offsetHeight / 2);
        eventSender.mouseDown();
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + target.offsetWidth + 5,
            selection.computeTop(target) + target.offsetHeight / 2);
        eventSender.leapForward(250);
        eventSender.mouseUp();
    },
    [
        'abc',
        '<div contenteditable id="target" style="float: left;">X^YZ|</div>',
        '<div style="float: left; width: 100%;">def</div>',
        'ghi',
    ]);
</script>
